package com.hfjava.ebook.server.impl;

import com.hfjava.ebook.entity.Category;
import com.hfjava.ebook.mapper.CategoryMapper;
import com.hfjava.ebook.server.CategoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(rollbackFor = {Exception.class})
public class CategoryServiceImpl implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;

    @Override
    @Transactional(readOnly = true,propagation = Propagation.SUPPORTS,rollbackFor = {Exception.class})
    public Category findCategoryById(int id) {
        return categoryMapper.getCategoryById(id);
    }

    @Override
    public List<Category> findCategoryByPid(int pid) {
        return null;
    }
}
